﻿using System;
using System.Data.SqlClient;
using System.Data;

using DevExpress.XtraReports.UI;
using prjKQXS_DLL;

namespace prjKQXS_Report.Truyen_thong
{
    public partial class rptThongKeTT_CB_Ngay : DevExpress.XtraReports.UI.XtraReport
    {
        public DataTable dtSource;

        public rptThongKeTT_CB_Ngay()
        {
            InitializeComponent();
        }

        private void rptThongKeTT_CB_Ngay_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
            Report_DAL report_dal = new Report_DAL();
            dsReports dsReports1 = new dsReports();
            dsReports1 = report_dal.reportDungChung(dsReports1);

            dsReports1.Tables.Remove("TruyenThong");
            dsReports1.Tables.Add(dtSource);
            this.DataSource = dsReports1;
            this.DataMember = "TruyenThong";
        }
        
        bool isLoad = true;
        decimal venhan1 = 0;
        decimal veban1 = 0;
        decimal ht = 0;
        private void Detail_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {           
            if (isLoad)
            {
                venhan1 += (decimal)clsCommon.Parse(lblSlvenhan1.Text, 3);
                veban1 += (decimal)clsCommon.Parse(lblSlveban1.Text, 3);
            }
            isLoad = true;
        }
       
        private void GroupFooter1_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
        {
                       
            venhan1 += (decimal)clsCommon.Parse(lblSlvenhan1.Text, 3);
            veban1 += (decimal)clsCommon.Parse(lblSlveban1.Text, 3);
            if (venhan1 != 0)
            {
                lblHT2.Text = venhan1.ToString();
            }
            ht = 0;
            venhan1 = 0;
            veban1 = 0;
            isLoad = false;
        }
    }
}
